package me.sdevil507.systemAssist.systemLog.po;

import lombok.Data;
import lombok.EqualsAndHashCode;
import me.sdevil507.supports.jpa.BaseJpaSnowflakeIdEntity;
import org.hibernate.annotations.Formula;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.util.Date;

/**
 * 操作日志
 *
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "system_log_error")
public class SystemErrorLogPo extends BaseJpaSnowflakeIdEntity {

    /**
     * 操作终端
     */
    @Column
    private String operTerminal;
    /**
     * 操作分类
     */
    @Column
    private String operClassify;
    /**
     * 操作模块
     */
    @Column
    private String operModule;
    /**
     * 操作方法
     */
    @Column
    private String operMethod;
    /**
     * 请求URI
     */
    @Column
    private String errorRequestURI;
    /**
     * 请求IP
     */
    @Column
    private String errorRequestIp;
    /**
     * 请求参数
     */
    @Column
    private String errorRequestParam;
    /**
     * 异常名称
     */
    @Column
    private String errorName;
    /**
     * 异常信息
     */
    @Column(columnDefinition = "text")
    @Lob
    private String errorMessage;
    /**
     * 操作人id
     */
    @Column
    private Long userId;
    /**
     * 操作人名称
     */
    @Column
    private String userName;
    @Formula("(select t.real_name from user as t  where t.id=user_id)")
    private String orgRealName;
    @Formula("(select t.real_name from plat_user as t  where t.id=user_id)")
    private String platformRealName;
    /**
     * 创建时间
     */
    @Column
    private Date createTime = new Date();
}
